<template>
    <div>
        <el-card class="!border-none" shadow="never">
            <el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
                <el-form-item label="团长用户ID">
                    <el-input
                            class="w-[150px]"
                            v-model="queryParams.uuid"
                            placeholder="请输入团长ID"
                            clearable
                            @keyup.enter="resetPage"
                    />
                </el-form-item>
                <el-form-item label="团长姓名|手机号|社区名称">
                    <el-input
                            class="w-[280px]"
                            v-model="queryParams.user_keys"
                            placeholder="请输入姓名|手机号|社区名称"
                            clearable
                            @keyup.enter="resetPage"
                    />
                </el-form-item>
                <el-form-item label="搜索时间">
                    <daterange-picker
                            v-model:startTime="queryParams.start_time"
                            v-model:endTime="queryParams.end_time"
                    >
                    </daterange-picker>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="resetPage">查询</el-button>
                    <el-button @click="resetParams">重置</el-button>
<!--                    <el-button type="success">导出</el-button>-->
                </el-form-item>
            </el-form>
        </el-card>
        <el-card class="!border-none mt-4" shadow="never">
            <el-table size="large" v-loading="pager.loading" :data="pager.lists" style="width: 100%" @selection-change="handleSelectionChange">
                <el-table-column type="selection" width="55" />
                <el-table-column label="团长信息" prop="uuid" min-width="120">
                    <template #default="{ row }">
                        <div>ID：{{ row.uuid }}</div>
                        <div>姓名：{{ row.name }}</div>
                        <div>手机号：{{ row.phone }}</div>
                        <div>社区：{{ row.community_name }}</div>
                    </template>
                </el-table-column>
                <el-table-column label="总分润(包含预估和已到账)" prop="name" min-width="120">
                    <template #default="{ row }">
                        {{ row.total_pre_commission }}
                    </template>
                </el-table-column>
                <el-table-column label="今日总分润(包含预估和已到账)" prop="name" min-width="120">
                    <template #default="{ row }">
                        {{ row.today_pre_commission }}
                    </template>
                </el-table-column>
            </el-table>
            <div class="flex justify-end mt-4">
                <pagination v-model="pager" @change="getLists" />
            </div>
        </el-card>
    </div>
</template>
<script lang="ts" setup>
    import { getCommissionList } from '@/api/finance'
    import { usePaging } from '@/hooks/usePaging'
    import feedback from "@/utils/feedback";
    import router, { getRoutePath } from '@/router'
    import {useDictOptions} from "@/hooks/useDictOptions";

    const queryParams = reactive({
        uuid: '',
        user_keys: '',
        start_time: '',
        end_time: '',
        export: '',
    });

    const { pager, getLists, resetPage, resetParams } = usePaging({
        fetchFun: getCommissionList,
        params: queryParams
    });

    getLists();

    // const { optionsData } = useDictOptions<{
    //     lists: any[]
    // }>({
    //     lists: {
    //         api: getRechargeType
    //     }
    // });


    const handleSelectionChange = (val: any) => {
        console.log(val)
        // ids.value = val.map((item: any) => {
        //     return item
        // })
    }

</script>
